<?php
namespace zake\foundation\stream;

use zake\foundation\able\stream\RwAble;
use zake\foundation\able\traits\ReadTrait;
use zake\foundation\able\traits\ResourceTrait;
use zake\foundation\able\traits\WriteTrait;
use zake\helper\Console;


class RwStream implements RwAble
{
    use ResourceTrait,ReadTrait,WriteTrait;


    public static function create($resource)
    {
        return new static($resource);
    }

    /**
     * 构造器
     *
     * ReadStream constructor.
     * @param $resource
     */
    protected function __construct($resource)
    {
        $this->resource = $resource;
        $this->fd = (int)$resource;
    }


    public function __destruct()
    {
        //Console::warnning("rw __destruct. fd[".$this->fd."]");
    }

}
